home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume15 / olvwm-3.0 / part18 < prev    next >
Encoding:
Text File  |  1992-02-03  |  55.7 KB  |  1,996 lines

  1. Newsgroups: comp.sources.x
  2. Path: uunet!elroy.jpl.nasa.gov!ames!pasteur!nntp
  3. From: scott.oaks@East.Sun.COM (Scott Oaks)
  4. Subject: v15i164: OpenLook Virtual Window Mgr (3.0), Part18/21
  5. Message-ID: <1992Feb4.140021.8205@pasteur.Berkeley.EDU>
  6. Sender: dcmartin@msi.com (David C. Martin - Moderator)
  7. Nntp-Posting-Host: postgres.berkeley.edu
  8. Organization: University of California, at Berkeley
  9. References: <csx-15i147-olvwm-3.0@uunet.UU.NET>
  10. Date: Tue, 4 Feb 1992 14:00:21 GMT
  11. Approved: dcmartin@msi.com
  12.  
  13. Submitted-by: scott.oaks@East.Sun.COM (Scott Oaks)
  14. Posting-number: Volume 15, Issue 164
  15. Archive-name: olvwm-3.0/part18
  16.  
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  21. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  22. # If this archive is complete, you will see the following message at the end:
  23. #        "End of archive 18 (of 21)."
  24. # Contents:  Error.c Select.c gettext.c menu.h olvwmrc.man olwm.h
  25. # Wrapped by dcmartin@fascet on Tue Jan 14 05:54:48 1992
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'Error.c' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'Error.c'\"
  29. else
  30. echo shar: Extracting \"'Error.c'\" \(9595 characters\)
  31. sed "s/^X//" >'Error.c' <<'END_OF_FILE'
  32. X/*
  33. X *      (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
  34. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  35. X *      file for terms of the license.
  36. X */
  37. X
  38. X#ident "@(#)Error.c    1.1 olvwm version 1/3/92"
  39. X
  40. X/*
  41. X * Based on
  42. X#ident    "@(#)Error.c    26.9    91/09/14 SMI"
  43. X *
  44. X */
  45. X
  46. X#include <stdio.h>
  47. X#include <X11/Xproto.h>
  48. X#include <X11/Xlib.h>
  49. X
  50. X#include "i18n.h"
  51. X
  52. X/* globals */
  53. X
  54. X/* locals */
  55. Xstatic char    *hyperSensitive = NULL;
  56. X
  57. X#define NXOPCODES    128    /* # of X opcodes */
  58. Xtypedef struct {
  59. X    unsigned int fatal, warning, ignore;
  60. X} ErrorEntry;
  61. X
  62. X/* The following defines create bitmasks from the X Error Codes */
  63. X#define BReq    (1<<BadRequest)
  64. X#define BVal    (1<<BadValue)
  65. X#define BWin    (1<<BadWindow)
  66. X#define BPix    (1<<BadPixmap)
  67. X#define BAtm    (1<<BadAtom)
  68. X#define BCur    (1<<BadCursor)
  69. X#define BFnt    (1<<BadFont)
  70. X#define BMch    (1<<BadMatch)
  71. X#define BDrw    (1<<BadDrawable)
  72. X#define BAcc    (1<<BadAccess)
  73. X#define BAlc    (1<<BadAlloc)
  74. X#define BCol    (1<<BadColor)
  75. X#define BGC    (1<<BadGC)
  76. X#define BIDC    (1<<BadIDChoice)
  77. X#define BNam    (1<<BadName)
  78. X#define BLen    (1<<BadLength)
  79. X#define BImp    (1<<BadImplementation)
  80. X
  81. X#define BAll    (~0)    /* matches all error bitmasks */
  82. X
  83. X/* This error table encodes the severity of an error in relation to
  84. X * an X primitive. For instance if BadWindow was fatal for
  85. X * a certain primitive but BadColor was not, the following entry would be used:
  86. X *    {BWin,    BCol,    0}
  87. X */
  88. Xstatic ErrorEntry errorTable[NXOPCODES] = {
  89. X    {BAll,    0,    0},    /* 0, Not Used */
  90. X    {BAll,    0,    0},    /* 1, X_CreateWindow */
  91. X    {0,    ~BWin,    BWin},    /* 2, X_ChangeWindowAttributes */
  92. X    {0,    ~BWin,    BWin},    /* 3, X_GetWindowAttributes */
  93. X    {0,    BAll,    0},    /* 4, X_DestroyWindow */
  94. X    {0,    BAll,    0},    /* 5, X_DestroySubwindows */
  95. X    {0,    ~BWin,    BWin},    /* 6, X_ChangeSaveSet */
  96. X    {0,    ~BWin,    BWin},    /* 7, X_ReparentWindow */
  97. X    {0,    ~BWin,    BWin},    /* 8, X_MapWindow */
  98. X    {0,    BAll,    0},    /* 9, X_MapSubwindows */
  99. X    {0,    ~BWin,    BWin},    /* 10, X_UnmapWindow */
  100. X    {0,    BAll,    0},    /* 11, X_UnmapSubwindows */
  101. X    {0,    ~BWin,    BWin},    /* 12, X_ConfigureWindow */
  102. X    {0,    BAll,    0},    /* 13, X_CirculateWindow */
  103. X    {0,    ~BDrw,    BDrw},    /* 14, X_GetGeometry */
  104. X    {0,    ~BWin,    BWin},    /* 15, X_QueryTree */
  105. X    {0,    BAll,    0},    /* 16, X_InternAtom */
  106. X    {0,    BAll,    0},    /* 17, X_GetAtomName */
  107. X    {0,    ~BWin,    BWin},    /* 18, X_ChangeProperty */
  108. X    {0,    BAll,    0},    /* 19, X_DeleteProperty */
  109. X    {0,    ~BWin,    BWin},    /* 20, X_GetProperty */
  110. X    {0,    BAll,    0},    /* 21, X_ListProperties */
  111. X    {0,    BAll,    0},    /* 22, X_SetSelectionOwner */
  112. X    {0,    BAll,    0},    /* 23, X_GetSelectionOwner */
  113. X    {0,    BAll,    0},    /* 24, X_ConvertSelection */
  114. X    {0,    ~BWin,    BWin},    /* 25, X_SendEvent */
  115. X    {0,    0,    BAll},    /* 26, X_GrabPointer */
  116. X    {0,    0,    BAll},    /* 27, X_UngrabPointer */
  117. X    {0,    0,    BAll},    /* 28, X_GrabButton */
  118. X    {0,    0,    BAll},    /* 29, X_UngrabButton */
  119. X    {0,    0,    BAll},    /* 30, X_ChangeActivePointerGrab */
  120. X    {0,    BAll,    0},    /* 31, X_GrabKeyboard */
  121. X    {0,    BAll,    0},    /* 32, X_UngrabKeyboard */
  122. X    {0,    BAll,    0},    /* 33, X_GrabKey */
  123. X    {0,    BAll,    0},    /* 34, X_UngrabKey */
  124. X    {0,    BAll,    0},    /* 35, X_AllowEvents */
  125. X    {BAll,    0,    0},    /* 36, X_GrabServer */
  126. X    {0,    BAll,    0},    /* 37, X_UngrabServer */
  127. X    {0,    BAll,    0},    /* 38, X_QueryPointer */
  128. X    {0,    BAll,    0},    /* 39, X_GetMotionEvents */
  129. X    {0,    BAll,    0},    /* 40, X_TranslateCoords */
  130. X    {0,    BAll,    0},    /* 41, X_WarpPointer */
  131. X    {0,    ~(BMch|BWin),    BMch|BWin},    /* 42, X_SetInputFocus */
  132. X    {0,    BAll,    0},    /* 43, X_GetInputFocus */
  133. X    {0,    BAll,    0},    /* 44, X_QueryKeymap */
  134. X    {0,    BAll,    0},    /* 45, X_OpenFont */
  135. X    {0,    BAll,    0},    /* 46, X_CloseFont */
  136. X    {0,    BAll,    0},    /* 47, X_QueryFont */
  137. X    {0,    BAll,    0},    /* 48, X_QueryTextExtents */
  138. X    {0,    BAll,    0},    /* 49, X_ListFonts */
  139. X    {0,    BAll,    0},    /* 50, X_ListFontsWithInfo */
  140. X    {0,    BAll,    0},    /* 51, X_SetFontPath */
  141. X    {0,    BAll,    0},    /* 52, X_GetFontPath */
  142. X    {0,    BAll,    0},    /* 53, X_CreatePixmap */
  143. X    {0,    BAll,    0},    /* 54, X_FreePixmap */
  144. X    {0,    BAll,    0},    /* 55, X_CreateGC */
  145. X    {0,    BAll,    0},    /* 56, X_ChangeGC */
  146. X    {0,    BAll,    0},    /* 57, X_CopyGC */
  147. X    {0,    BAll,    0},    /* 58, X_SetDashes */
  148. X    {0,    BAll,    0},    /* 59, X_SetClipRectangles */
  149. X    {0,    BAll,    0},    /* 60, X_FreeGC */
  150. X    {0,    ~BMch,    BMch},    /* 61, X_ClearArea */
  151. X    {0,    BAll,    0},    /* 62, X_CopyArea */
  152. X    {0,    BAll,    0},    /* 63, X_CopyPlane */
  153. X    {0,    BAll,    0},    /* 64, X_PolyPoint */
  154. X    {0,    BAll,    0},    /* 65, X_PolyLine */
  155. X    {0,    BAll,    0},    /* 66, X_PolySegment */
  156. X    {0,    BAll,    0},    /* 67, X_PolyRectangle */
  157. X    {0,    BAll,    0},    /* 68, X_PolyArc */
  158. X    {0,    BAll,    0},    /* 69, X_FillPoly */
  159. X    {0,    BAll,    0},    /* 70, X_PolyFillRectangle */
  160. X    {0,    BAll,    0},    /* 71, X_PolyFillArc */
  161. X    {0,    BAll,    0},    /* 72, X_PutImage */
  162. X    {0,    BAll,    0},    /* 73, X_GetImage */
  163. X    {0,    BAll,    0},    /* 74, X_PolyText8 */
  164. X    {0,    BAll,    0},    /* 75, X_PolyText16 */
  165. X    {0,    BAll,    0},    /* 76, X_ImageText8 */
  166. X    {0,    BAll,    0},    /* 77, X_ImageText16 */
  167. X    {0,    BAll,    0},    /* 78, X_CreateColormap */
  168. X    {0,    BAll,    0},    /* 79, X_FreeColormap */
  169. X    {0,    BAll,    0},    /* 80, X_CopyColormapAndFree */
  170. X    {0,    BAll,    0},    /* 81, X_InstallColormap */
  171. X    {0,    BAll,    0},    /* 82, X_UninstallColormap */
  172. X    {0,    BAll,    0},    /* 83, X_ListInstalledColormaps */
  173. X    {0,    BAll,    0},    /* 84, X_AllocColor */
  174. X    {0,    BAll,    0},    /* 85, X_AllocNamedColor */
  175. X    {0,    BAll,    0},    /* 86, X_AllocColorCells */
  176. X    {0,    BAll,    0},    /* 87, X_AllocColorPlanes */
  177. X    {0,    BAll,    0},    /* 88, X_FreeColors */
  178. X    {0,    BAll,    0},    /* 89, X_StoreColors */
  179. X    {0,    BAll,    0},    /* 90, X_StoreNamedColor */
  180. X    {0,    BAll,    0},    /* 91, X_QueryColors */
  181. X    {0,    BAll,    0},    /* 92, X_LookupColor */
  182. X    {0,    BAll,    0},    /* 93, X_CreateCursor */
  183. X    {0,    BAll,    0},    /* 94, X_CreateGlyphCursor */
  184. X    {0,    BAll,    0},    /* 95, X_FreeCursor */
  185. X    {0,    BAll,    0},    /* 96, X_RecolorCursor */
  186. X    {0,    BAll,    0},    /* 97, X_QueryBestSize */
  187. X    {0,    BAll,    0},    /* 98, X_QueryExtension */
  188. X    {0,    BAll,    0},    /* 99, X_ListExtensions */
  189. X    {0,    BAll,    0},    /* 100, X_ChangeKeyboardMapping */
  190. X    {0,    BAll,    0},    /* 101, X_GetKeyboardMapping */
  191. X    {0,    BAll,    0},    /* 102, X_ChangeKeyboardControl */
  192. X    {0,    BAll,    0},    /* 103, X_GetKeyboardControl */
  193. X    {0,    BAll,    0},    /* 104, X_Bell */
  194. X    {0,    BAll,    0},    /* 105, X_ChangePointerControl */
  195. X    {0,    BAll,    0},    /* 106, X_GetPointerControl */
  196. X    {0,    BAll,    0},    /* 107, X_SetScreenSaver */
  197. X    {0,    BAll,    0},    /* 108, X_GetScreenSaver */
  198. X    {0,    BAll,    0},    /* 109, X_ChangeHosts */
  199. X    {0,    BAll,    0},    /* 110, X_ListHosts */
  200. X    {0,    BAll,    0},    /* 111, X_SetAccessControl */
  201. X    {0,    BAll,    0},    /* 112, X_SetCloseDownMode */
  202. X    {0,    BAll,    0},    /* 113, X_KillClient */
  203. X    {0,    BAll,    0},    /* 114, X_RotateProperties */
  204. X    {0,    BAll,    0},    /* 115, X_ForceScreenSaver */
  205. X    {0,    BAll,    0},    /* 116, X_SetPointerMapping */
  206. X    {0,    BAll,    0},    /* 117, X_GetPointerMapping */
  207. X    {0,    BAll,    0},    /* 118, X_SetModifierMapping */
  208. X    {0,    BAll,    0},    /* 119, X_GetModifierMapping */
  209. X    {BAll,    0,    0},    /* 120, Not Used */
  210. X    {BAll,    0,    0},    /* 121, Not Used */
  211. X    {BAll,    0,    0},    /* 122, Not Used */
  212. X    {BAll,    0,    0},    /* 123, Not Used */
  213. X    {BAll,    0,    0},    /* 124, Not Used */
  214. X    {BAll,    0,    0},    /* 125, Not Used */
  215. X    {BAll,    0,    0},    /* 126, Not Used */
  216. X    {0,    BAll,    0},    /* 127, X_NoOperation */
  217. X    };
  218. X/*
  219. X * ErrorSensitive -- cause an exit on all X errors
  220. X */
  221. XErrorSensitive(s)
  222. Xchar    *s;
  223. X{
  224. X    hyperSensitive = s;
  225. X}
  226. X
  227. X/*
  228. X * ErrorInsensitive -- perform normal X error processing
  229. X */
  230. X/*ARGSUSED*/    /* dpy arg will be used when multiple Displays supported */
  231. XErrorInsensitive(dpy)
  232. XDisplay    *dpy;
  233. X{
  234. X    hyperSensitive = NULL;
  235. X}
  236. X
  237. X/*
  238. X * ErrorHandler -- this routine is called whenever an error in the X
  239. X *    protocol is detected.
  240. X */
  241. XErrorHandler(dpy, event)
  242. XDisplay    *dpy;
  243. XXErrorEvent    *event;
  244. X{
  245. X    char    buffer[BUFSIZ];
  246. X    int    errBitmask;
  247. X
  248. X    XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
  249. X
  250. X    if (hyperSensitive != NULL)
  251. X    {
  252. X        /* treat all errors as fatal */
  253. X        (void) fprintf(stderr, gettext("olvwm: Fatal X Error: %s\n"), buffer);
  254. X        (void) fprintf(stderr, "%s\n", hyperSensitive);
  255. X        exit(-1);
  256. X        /*NOTREACHED*/
  257. X    }
  258. X
  259. X    errBitmask = 1 << event->error_code;
  260. X
  261. X    if (errBitmask & errorTable[event->request_code].ignore)
  262. X        return 0;
  263. X    else if (errBitmask & errorTable[event->request_code].warning)
  264. X    {
  265. X               (void) fprintf(stderr, gettext("olvwm: Warning, X Error: %s\n"),
  266. X                              buffer);
  267. X               (void) fprintf(stderr, gettext("  Request Major code: %d\n"),
  268. X                               event->request_code);
  269. X               (void) fprintf(stderr, gettext("  Request Minor code: %d\n"),
  270. X                               event->minor_code);
  271. X               (void) fprintf(stderr, gettext("  ResourceId 0x%x\n"),
  272. X                               event->resourceid);
  273. X        return 0;
  274. X    }
  275. X    else if (errBitmask & errorTable[event->request_code].fatal)
  276. X    {
  277. X               (void) fprintf(stderr, gettext("olvwm: Fatal X Error: %s\n"),
  278. X                              buffer);
  279. X               (void) fprintf(stderr, gettext("  Request Major code: %d\n"),
  280. X                               event->request_code);
  281. X               (void) fprintf(stderr, gettext("  Request Minor code: %d\n"),
  282. X                               event->minor_code);
  283. X               (void) fprintf(stderr, gettext("  ResourceId 0x%x\n"),
  284. X                               event->resourceid);
  285. X               (void) fprintf(stderr, gettext("  Error Serial #%d\n"),
  286. X                              event->serial);
  287. X               (void) fprintf(stderr, gettext("  Current Serial #%d\n"),
  288. X                              dpy->request);
  289. X        /* do not return from fatal errors */
  290. X        exit(-1);
  291. X        /*NOTREACHED*/
  292. X    }
  293. X
  294. X    return 0;
  295. X}
  296. X
  297. X/*
  298. X * ErrorGeneral -- this routine is called whenever a general error occurs
  299. X *      within OLWM.  Exits from olwm.
  300. X */
  301. XErrorGeneral(txt)
  302. Xchar *txt;
  303. X{
  304. X        (void) fprintf(stderr, gettext("olvwm: Fatal Error: %s\n"), txt);
  305. X#ifdef DEBUG
  306. X    abort();
  307. X    /*NOTREACHED*/
  308. X#else
  309. X        exit(-1);
  310. X    /*NOTREACHED*/
  311. X#endif
  312. X}
  313. X
  314. X/*
  315. X * ErrorWarning -- this routine is called whenever a condition requiring
  316. X *      a warning message occurs within OLWM.
  317. X */
  318. Xvoid
  319. XErrorWarning(txt)
  320. Xchar *txt;
  321. X{
  322. X        (void) fprintf(stderr, gettext("olvwm: Warning: %s\n"), txt);
  323. X}
  324. X
  325. END_OF_FILE
  326. if test 9595 -ne `wc -c <'Error.c'`; then
  327.     echo shar: \"'Error.c'\" unpacked with wrong size!
  328. fi
  329. # end of 'Error.c'
  330. fi
  331. if test -f 'Select.c' -a "${1}" != "-c" ; then 
  332.   echo shar: Will not clobber existing file \"'Select.c'\"
  333. else
  334. echo shar: Extracting \"'Select.c'\" \(9439 characters\)
  335. sed "s/^X//" >'Select.c' <<'END_OF_FILE'
  336. X/*
  337. X *      (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
  338. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  339. X *      file for terms of the license.
  340. X */
  341. X
  342. X#ident    "@(#)Select.c    26.13    91/09/14 SMI"
  343. X
  344. X#include <errno.h>
  345. X#include <stdio.h>
  346. X#include <string.h>
  347. X#include <X11/Xos.h>
  348. X#include <X11/Xlib.h>
  349. X#include <X11/Xutil.h>
  350. X#include <X11/Xatom.h>
  351. X
  352. X#include "i18n.h"
  353. X#include "olwm.h"
  354. X#include "win.h"
  355. X#include "list.h"
  356. X#include "mem.h"
  357. X
  358. Xstatic List *selectList = NULL_LIST;
  359. X
  360. XTime SelectionTime;
  361. X
  362. X/* Externals */
  363. Xextern Atom    AtomAtomPair;
  364. Xextern Atom    AtomLength;
  365. Xextern Atom    AtomListLength;
  366. Xextern Atom    AtomName;
  367. Xextern Atom    AtomMultiple;
  368. Xextern Atom    AtomOlwmTimestamp;
  369. Xextern Atom    AtomTargets;
  370. Xextern Atom    AtomTimestamp;
  371. X
  372. X/*
  373. X * IsSelected -- returns boolean telling whether or not client is selected.
  374. X *
  375. X * Input:
  376. X *
  377. X *    cli    - client which might be on selection list.
  378. X *
  379. X * Output:
  380. X *
  381. X *    Returns True if the client cli is on the selection list.
  382. X *    Returns False if it is not.
  383. X *
  384. X * Globals:
  385. X *
  386. X *    selectList    - The list of selected windows.
  387. X */
  388. XBool
  389. XIsSelected(cli)
  390. XClient *cli;
  391. X{
  392. X    return cli->isSelected;
  393. X}
  394. X
  395. X
  396. X/*
  397. X * AddSelection -- add this client to the selection list if it is not 
  398. X *    already present.  This routine also tells the server it is the current 
  399. X *    XA_PRIMARY selection owner.
  400. X *
  401. X * Input:
  402. X *
  403. X *    cli    - The client we are adding to the selectList.
  404. X *
  405. X * Output:
  406. X *
  407. X *    None.
  408. X *
  409. X * Globals:
  410. X *
  411. X *    selectList    - The list of selected windows.
  412. X *    The current selection owner in the server is also adjusted.
  413. X */
  414. Xint
  415. XAddSelection(cli, timestamp)
  416. XClient *cli;
  417. XTime timestamp;
  418. X{
  419. X    List *l = selectList;
  420. X    Client *tc;
  421. X
  422. X    if (selectList == NULL_LIST)
  423. X    {
  424. X        /* Tell the server that we are now the 
  425. X         * current selection owner.
  426. X         * We really only need to call this 
  427. X         * if this is the first window
  428. X         * in the SelectList.  Calling this sends the
  429. X         * previous owner of the XA_PRIMARY selection 
  430. X         * a SelectionClear event, unless the previous 
  431. X         * owner was us already.
  432. X          */
  433. X        XSetSelectionOwner(cli->dpy, XA_PRIMARY, 
  434. X                   NoFocusWin,
  435. X                   timestamp);
  436. X    }
  437. X    else
  438. X    {
  439. X        /* First look to see if window is already listed. */
  440. X        for(tc = ListEnum(&l); tc != NULL; tc = ListEnum(&l))
  441. X        {
  442. X            if (tc == cli)
  443. X                return;
  444. X        }
  445. X    }
  446. X
  447. X    /* If we get here the window wasn't already in the list. */
  448. X    selectList = ListCons(cli,selectList);
  449. X    cli->isSelected = True;
  450. X
  451. X    /* Tell the window it is selected. */
  452. X    WinCallSelect(cli, True);
  453. X    SelectionTime = timestamp;
  454. X}
  455. X
  456. X/*
  457. X * RemoveSelection -- de-select the window
  458. X *
  459. X * Purpose:
  460. X *     This routine will remove an entry from the SelectList.
  461. X * Input:
  462. X *
  463. X *    winInfo    - The window we are removing from the SelectList.
  464. X *
  465. X * Output:
  466. X *    Returns True if client was deselected; false if the
  467. X *    client was not already selected.
  468. X *
  469. X * Globals:
  470. X *
  471. X *    selectList    - The list of selected windows.
  472. X */
  473. XBool
  474. XRemoveSelection(cli)
  475. XClient *cli;
  476. X{
  477. X    List **l;
  478. X
  479. X    for (l = &selectList ; *l != NULL; l = &((*l)->next))
  480. X    {
  481. X        if ((*l)->value == cli)
  482. X        {
  483. X            ListDestroyCell(l);
  484. X            cli->isSelected = False;
  485. X            WinCallSelect(cli,False);
  486. X            return True;
  487. X        }
  488. X    }
  489. X    return False;
  490. X}
  491. X
  492. X
  493. X
  494. X/*
  495. X * ToggleSelection -- if the winInfo is already selected, then de-select it.
  496. X *    If not, then select it.
  497. X *    Returns whether it is selected or not.
  498. X */
  499. XBool
  500. XToggleSelection(cli, timestamp)
  501. XClient *cli;
  502. XTime timestamp;
  503. X{
  504. X
  505. X    /* If already present, we want to deselect. */
  506. X    if (RemoveSelection(cli))
  507. X        return False;
  508. X    else
  509. X    {
  510. X        AddSelection(cli, timestamp);
  511. X        return True;
  512. X    }
  513. X}
  514. X
  515. X
  516. X/*
  517. X * ClearSelections -- clear the selection list
  518. X */
  519. X/*ARGSUSED*/
  520. Xvoid
  521. XClearSelections(dpy)
  522. XDisplay    *dpy;
  523. X{
  524. X    List *l;
  525. X    Client *cli;
  526. X
  527. X    l = selectList;
  528. X    for(cli = ListEnum(&l); cli != NULL; cli = ListEnum(&l))
  529. X    {
  530. X        cli->isSelected = False;
  531. X        WinCallSelect(cli,False);
  532. X    }
  533. X    ListDestroy(selectList);
  534. X    selectList = NULL_LIST;
  535. X}
  536. X
  537. X/*
  538. X * EnumSelections --- enumerate the selected client structures.  
  539. X *    Pass NULL to begin enumeration; any non-NULL value thereafter
  540. X *    will continue enumeration where it left off.  This function
  541. X *    uses static data, so only one enumeration can happen at any
  542. X *    given time.
  543. X *    Returns NULL when list is exhausted.
  544. X */
  545. XClient *
  546. XEnumSelections(foo)
  547. Xvoid *foo;
  548. X{
  549. X    static List *l;
  550. X    Client *ct;
  551. X
  552. X    if (foo == NULL)
  553. X        l = selectList;
  554. X
  555. X    if (l != NULL)
  556. X    {
  557. X        ct = l->value;
  558. X        l = l->next;
  559. X        return ct;
  560. X    }
  561. X    return NULL;
  562. X}
  563. X
  564. X
  565. X/*
  566. X * Handle the conversion of a single target.  Used for both single requests 
  567. X * and for MULTIPLE requests.  Returns True if the conversion was successful, 
  568. X * otherwise False.
  569. X */
  570. Xstatic Bool
  571. XhandleTarget(dpy, requestor, target, property)
  572. X    Display *dpy;
  573. X    Window requestor;
  574. X    Atom target;
  575. X    Atom property;
  576. X{
  577. X    unsigned long data[10];    /* long enough for most things */
  578. X    unsigned char *propdata = (unsigned char *) data;
  579. X    int format, nelements, i;
  580. X    Client *cli;
  581. X    Atom type;
  582. X    Bool freedata = False;
  583. X    Window *wp;
  584. X
  585. X    if (target == AtomTargets) {
  586. X    data[0] = AtomTargets;
  587. X    data[1] = AtomTimestamp;
  588. X    data[2] = AtomListLength;
  589. X    data[3] = XA_DRAWABLE;
  590. X    data[4] = AtomLength;
  591. X    data[5] = AtomMultiple;
  592. X    data[6] = AtomName;
  593. X    nelements = 7;
  594. X    type = XA_ATOM;
  595. X    format = 32;
  596. X    } else if (target == AtomTimestamp) {
  597. X    data[0] = SelectionTime;
  598. X    nelements = 1;
  599. X    type = XA_INTEGER;
  600. X    format = 32;
  601. X    } else if (target == AtomListLength) {
  602. X    data[0] = ListCount(selectList);
  603. X    nelements = 1;
  604. X    type = XA_INTEGER;
  605. X    format = 32;
  606. X    } else if (target == AtomLength) {
  607. X    data[0] = ListCount(selectList)*sizeof(long);
  608. X    nelements = 1;
  609. X    type = XA_INTEGER;
  610. X    format = 32;
  611. X    } else if (target == XA_DRAWABLE) {
  612. X    nelements = ListCount(selectList);
  613. X    propdata = (unsigned char *)
  614. X            MemCalloc(nelements, sizeof(unsigned long));
  615. X    freedata = True;
  616. X    wp = (Window *) propdata;
  617. X    i = 0;
  618. X    cli = NULL;
  619. X    while ((cli = EnumSelections(cli)) && (i<nelements))
  620. X        *wp++ = PANEWINOFCLIENT(cli);
  621. X    type = XA_DRAWABLE;
  622. X    format = 32;
  623. X    } else if (target == AtomName) {
  624. X    int curlen = 0;
  625. X    int maxlen = 100;
  626. X    int tmplen;
  627. X    char *cp, *tmp;
  628. X
  629. X    propdata = MemAlloc(maxlen);
  630. X    cp = (char *) propdata;
  631. X
  632. X    cli = NULL;
  633. X    while (cli = EnumSelections(cli)) {
  634. X        if (cli->framewin != NULL && cli->framewin->fcore.name != NULL)
  635. X        tmp = cli->framewin->fcore.name;
  636. X        else
  637. X        tmp = "";
  638. X
  639. X        tmplen = strlen(tmp) + 1;
  640. X        if (curlen + tmplen > maxlen) {
  641. X        maxlen += 100;
  642. X        propdata = MemRealloc(propdata, maxlen);
  643. X        }
  644. X        strcpy((char *) propdata+curlen, tmp);
  645. X        curlen += tmplen;
  646. X    }
  647. X
  648. X    nelements = curlen;
  649. X    type = XA_STRING;
  650. X    format = 8;
  651. X    } else {
  652. X    return False;
  653. X    }
  654. X
  655. X    XChangeProperty(dpy, requestor, property, type, format, PropModeReplace,
  656. X            (unsigned char *)propdata, nelements);
  657. X
  658. X    if (freedata)
  659. X    MemFree(propdata);
  660. X
  661. X    return True;
  662. X}
  663. X
  664. X
  665. X/*
  666. X * SelectionResponse
  667. X * Respond to a selection request in the manner specified by the ICCCM.
  668. X * If we understand the target, write the appropriate property and send the 
  669. X * event.  If we don't understand the target, just send the event.
  670. X */
  671. Xvoid
  672. XSelectionResponse(request)
  673. X    XSelectionRequestEvent *request;
  674. X{
  675. X    XSelectionEvent response;
  676. X    Atom *pairs;
  677. X    Atom zeroatom = None;
  678. X    unsigned long nitems, remain;
  679. X    int i;
  680. X    Bool writeback = False;
  681. X
  682. X    response.type = SelectionNotify;
  683. X    response.serial = request->serial;
  684. X    response.requestor = request->requestor;
  685. X    response.selection = request->selection;
  686. X    response.time = request->time;
  687. X    response.target = None;
  688. X    response.property = None;
  689. X
  690. X    if (request->target == AtomMultiple) {
  691. X    if (request->property != None) {
  692. X        pairs = GetWindowProperty(request->display, request->requestor,
  693. X                      request->property, 0L, 100000L,
  694. X                      AtomAtomPair, 32, &nitems, &remain);
  695. X
  696. X        if (pairs != NULL) {
  697. X
  698. X        /*
  699. X         * Process each pair of atoms (target, property).  Watch out 
  700. X         * for an odd last atom, and for property atoms of None.  If 
  701. X         * the conversion fails, replace it with None in the original 
  702. X         * property.
  703. X         */
  704. X
  705. X        for (i = 0; i+1 < nitems; i += 2) {
  706. X
  707. X            if (pairs[i+1] == None)
  708. X            continue;
  709. X
  710. X            if (!handleTarget(request->display, request->requestor,
  711. X                      pairs[i], pairs[i+1]))
  712. X            {
  713. X            pairs[i+1] = None;
  714. X            writeback = True;
  715. X            }
  716. X        }
  717. X
  718. X        if (writeback)
  719. X            XChangeProperty(request->display, request->requestor,
  720. X            request->property, AtomAtomPair, 32, PropModeReplace,
  721. X            (unsigned char *) pairs, nitems);
  722. X
  723. X        XFree((char *) pairs);
  724. X        }
  725. X
  726. X        response.target = AtomMultiple;
  727. X        response.property = request->property;
  728. X
  729. X    }
  730. X    } else {
  731. X    /*
  732. X     * If the property field is None, the requestor is using an obsolete
  733. X     * draft of the ICCCM.  Per the suggestion in ICCCM section 2.2, use
  734. X     * the target name as the property name.
  735. X     */
  736. X    if (request->property == None)
  737. X        request->property = request->target;
  738. X
  739. X    if (handleTarget(request->display, request->requestor,
  740. X             request->target, request->property))
  741. X    {
  742. X        response.target = request->target;
  743. X        response.property = request->property;
  744. X    }
  745. X    }
  746. X
  747. X    XSendEvent(request->display, request->requestor, False,
  748. X           NoEventMask, (XEvent *)&response);
  749. X}
  750. X
  751. X/* TimeFresh -- get a fresh timestamp from the server
  752. X */
  753. XTime
  754. XTimeFresh(win)
  755. XWinGeneric *win;
  756. X{
  757. X    XEvent e;
  758. X    Time timestamp;
  759. X
  760. X    XChangeProperty(win->core.client->dpy, win->core.self,
  761. X        AtomOlwmTimestamp, XA_INTEGER,
  762. X        32, PropModeReplace, (unsigned char *)win, 0);
  763. X    XSync(win->core.client->dpy,0);
  764. X    if (XCheckTypedWindowEvent(win->core.client->dpy, win->core.self,
  765. X        PropertyNotify, &e))
  766. X        timestamp = e.xproperty.time;
  767. X    else
  768. X        timestamp = CurrentTime;
  769. X
  770. X    return timestamp;
  771. X}
  772. END_OF_FILE
  773. if test 9439 -ne `wc -c <'Select.c'`; then
  774.     echo shar: \"'Select.c'\" unpacked with wrong size!
  775. fi
  776. # end of 'Select.c'
  777. fi
  778. if test -f 'gettext.c' -a "${1}" != "-c" ; then 
  779.   echo shar: Will not clobber existing file \"'gettext.c'\"
  780. else
  781. echo shar: Extracting \"'gettext.c'\" \(9213 characters\)
  782. sed "s/^X//" >'gettext.c' <<'END_OF_FILE'
  783. X/*    Copyright (c) 1990 Sun Microsystems    */
  784. X/*      All Rights Reserved      */
  785. X
  786. X#ident    "@(#)gettext.c    1.7    91/09/14 SMI"
  787. X
  788. X#ifdef SUNDAE
  789. X
  790. X#include "gettext.h"
  791. X
  792. X#ifdef SYSV
  793. X#define bzero(a,b) memset(a,0,b)
  794. X#endif
  795. X
  796. Xchar *malloc(), *strdup();
  797. Xchar * dgettext();
  798. Xchar *_gettext();
  799. Xchar *in_path();
  800. Xchar *fgets(), *getenv();
  801. Xcaddr_t mmap(), calloc();
  802. X
  803. Xstatic struct domain_binding *firstbind=0, *lastbind=0;
  804. X
  805. Xstatic void
  806. Xinitbindinglist()
  807. X{
  808. X    if (! firstbind) {
  809. X    firstbind =
  810. X        (struct domain_binding *) malloc(sizeof(struct domain_binding));
  811. X    firstbind->domain_name = strdup("");
  812. X    firstbind->binding = strdup(DEFAULT_BINDING);
  813. X    firstbind->nextdomain = (struct domain_binding *) 0;
  814. X    lastbind = firstbind;
  815. X    }
  816. X}
  817. X
  818. Xstatic char *
  819. Xlookupdefbind(domain_name)
  820. X    char    *domain_name;
  821. X{
  822. X    static char *binding = NULL; /* psuedo static ptr for return value */
  823. X    static int bindinglen = 0;
  824. X    char *bindptr = firstbind->binding;
  825. X    char *current_locale;
  826. X    char chartmp;
  827. X    char *bindtmptr, pathtmp[MAXPATHLEN], bindtmp[MAXPATHLEN];
  828. X    int newlen;
  829. X
  830. X    struct stat statbuf;
  831. X
  832. X    bindtmptr = bindtmp;
  833. X
  834. X    current_locale = setlocale(LC_MESSAGES, NULL);
  835. X
  836. X    while (chartmp = *bindptr++)  {
  837. X    switch (chartmp) {
  838. X
  839. X        case BINDINGLISTDELIM:
  840. X        *bindtmptr = '\0';
  841. X        strcpy(pathtmp, bindtmp);
  842. X        strcat(pathtmp, "/");
  843. X        strcat(pathtmp, current_locale);
  844. X        strcat(pathtmp, "/LC_MESSAGES/");
  845. X        strcat(pathtmp, domain_name);
  846. X        strcat(pathtmp, ".mo");
  847. X        
  848. X        if (stat(pathtmp, &statbuf)) {
  849. X            bindtmptr = bindtmp;
  850. X            break;
  851. X        }
  852. X
  853. X        if ((newlen = strlen(bindtmp)) > bindinglen) {
  854. X            bindinglen = newlen;
  855. X            if (binding) {
  856. X            free (binding);
  857. X            }
  858. X            binding = malloc(newlen+1);
  859. X            strcpy(binding, bindtmp);
  860. X        }
  861. X        return(binding);
  862. X
  863. X        default:
  864. X        *bindtmptr++ = chartmp;
  865. X        break;
  866. X    }
  867. X    }
  868. X    /*
  869. X     * NOT FOUND, return NULL
  870. X    */
  871. X    
  872. X    return (NULL);
  873. X}
  874. X
  875. Xchar *
  876. Xbindtextdomain(domain_name, binding)
  877. X    char    *domain_name;
  878. X    unsigned char *binding;
  879. X{
  880. X
  881. X    struct domain_binding *bind;
  882. X    char *lastpath;
  883. X    unsigned char pathtmp[MAXPATHLEN+1];
  884. X    int newlen;
  885. X
  886. X    pathtmp[0] = '\0';
  887. X
  888. X    /* Initialize list */
  889. X    if (! firstbind) {
  890. X    initbindinglist();
  891. X    }
  892. X    
  893. X    if (!domain_name) {
  894. X    return (NULL);
  895. X    }
  896. X
  897. X    if (*domain_name == '\0') {
  898. X    if (!binding) {
  899. X        /* query, add COOKIE to binding
  900. X         * return new binding cookie
  901. X        */
  902. X        pathtmp[0] = (unsigned char) COOKIE;
  903. X        pathtmp[1] = '\0';
  904. X        strcat(pathtmp, firstbind->binding);
  905. X        return (strdup(pathtmp));
  906. X    } else if (binding[0] == COOKIE) {
  907. X        /* result of a previous query,
  908. X         * restore old binding
  909. X        */
  910. X        firstbind->binding = strdup(binding+1);
  911. X        free(binding);
  912. X        return (NULL);
  913. X    } else {
  914. X        /* add binding to default binding list
  915. X        */
  916. X        strcat(pathtmp, firstbind->binding);
  917. X        free(firstbind->binding);
  918. X        strcat(pathtmp, binding);
  919. X        strcat(pathtmp, "\n");
  920. X        firstbind->binding = strdup(pathtmp);
  921. X        return (NULL);
  922. X    }
  923. X    }
  924. X    
  925. X    /* linear search for binding, rebind if found, add if not */
  926. X    bind = firstbind;
  927. X    while (bind) {
  928. X    if (!strcmp(domain_name, bind->domain_name)) {
  929. X        if (!binding) {
  930. X        return(bind->domain_name);
  931. X        }
  932. X        if (bind->domain_name) {
  933. X        free(bind->domain_name);
  934. X        }
  935. X        if (bind->binding) {
  936. X        free(bind->binding);
  937. X        }
  938. X        
  939. X        bind->domain_name = strdup(domain_name);
  940. X        bind->binding = strdup(binding);
  941. X        return (bind->binding);
  942. X    }
  943. X    bind = bind->nextdomain;
  944. X    }
  945. X    
  946. X    /* Not found in list, add it to the end */
  947. X
  948. X    if (!binding) {
  949. X    return (NULL);
  950. X    }
  951. X    lastbind = bind = lastbind->nextdomain =
  952. X    (struct domain_binding *) malloc(sizeof(struct domain_binding));
  953. X    bind->domain_name = strdup(domain_name);
  954. X    bind->binding = strdup(binding);
  955. X    bind->nextdomain = 0;
  956. X    return (bind->binding);
  957. X}
  958. X
  959. Xstatic char *
  960. Xfindtextdomain(domain_name)
  961. X    char *domain_name;
  962. X{
  963. X    struct domain_binding *bind;
  964. X    char *tmptr;
  965. X
  966. X    bind = firstbind;
  967. X
  968. X    if (!bind) {
  969. X        initbindinglist();
  970. X        return (lookupdefbind(domain_name));
  971. X    }
  972. X
  973. X    while (bind) {
  974. X    if (!strcmp(domain_name, bind->domain_name)) { 
  975. X        return (bind->binding);
  976. X    }
  977. X    bind = bind->nextdomain;
  978. X    }
  979. X
  980. X    /* not found, look for binding in default binding list */
  981. X    return (lookupdefbind(domain_name));
  982. X}
  983. X    
  984. X
  985. Xchar *
  986. Xtextdomain(domain_name)
  987. X    char    *domain_name;
  988. X{
  989. X    
  990. X    static int entered = 0;
  991. X
  992. X    static char    current_domain[MAX_DOMAIN_LENGTH + 1];
  993. X
  994. X    if (! entered) {
  995. X    strcpy(current_domain, DEFAULT_DOMAIN);
  996. X     entered = 1;
  997. X    }
  998. X
  999. X    if (domain_name == NULL) {
  1000. X    return(current_domain);
  1001. X    }
  1002. X
  1003. X    if (strlen(domain_name) > MAX_DOMAIN_LENGTH) {
  1004. X    return(NULL);
  1005. X    }
  1006. X
  1007. X    if (*domain_name == '\0') {
  1008. X    strcpy(current_domain, DEFAULT_DOMAIN);
  1009. X    } else {
  1010. X    strcpy(current_domain, domain_name);
  1011. X    }
  1012. X
  1013. X    return(current_domain);
  1014. X}
  1015. X
  1016. Xchar *
  1017. Xgettext(msg_id)
  1018. Xchar *msg_id;
  1019. X{
  1020. X    return (dgettext(NULL, msg_id));
  1021. X}
  1022. X
  1023. X
  1024. Xchar *
  1025. Xdgettext(domain_name, msg_id)
  1026. X    char    *domain_name;
  1027. X    char    *msg_id;
  1028. X{
  1029. X    char msgfile[MAXPATHLEN+1];
  1030. X
  1031. X    char *current_locale;
  1032. X    char *current_domain;
  1033. X    char *current_binding;
  1034. X    char *msgptr, *openwinhome = NULL;
  1035. X
  1036. X    struct stat statbuf;
  1037. X    int    fd = -1;
  1038. X    caddr_t addr;
  1039. X
  1040. X    int   msg_inc;
  1041. X
  1042. X    static int    top_list = 0;            /* top of message_so list */
  1043. X    static int    first_free = 0;            /* first free entry in list */
  1044. X    static int    last_entry_seen = 0;        /* try this one first */
  1045. X    static struct message_so messages_so[MAX_MSG];
  1046. X    static struct message_so  cur_mess_so;    /* holds current message domain */
  1047. X
  1048. X
  1049. X    current_locale = setlocale(LC_MESSAGES, NULL);
  1050. X
  1051. X    if (domain_name == NULL) {
  1052. X        current_domain = textdomain(NULL);
  1053. X    } else if (strlen(domain_name) > MAX_DOMAIN_LENGTH) {
  1054. X        return(msg_id);
  1055. X    } else if (*domain_name == '\0') {
  1056. X        current_domain = DEFAULT_DOMAIN;
  1057. X    } else {
  1058. X        current_domain = domain_name;
  1059. X    }
  1060. X
  1061. X    /* check to see if textdomain has changed    */
  1062. X
  1063. X
  1064. X    bzero(msgfile, sizeof(msgfile));
  1065. X    if (current_binding = findtextdomain(current_domain)) {
  1066. X    strcpy(msgfile, current_binding);
  1067. X    strcat(msgfile, "/");
  1068. X    strcat(msgfile, current_locale);
  1069. X    strcat(msgfile, "/LC_MESSAGES/");
  1070. X    strcat(msgfile, current_domain);
  1071. X    strcat(msgfile, ".mo");
  1072. X    } else {
  1073. X    return(msg_id);
  1074. X    }
  1075. X
  1076. X    msg_inc = top_list;
  1077. X    while (msg_inc < first_free) {
  1078. X    if (!strcmp(msgfile, messages_so[msg_inc].message_so_path)) {
  1079. X        if (messages_so[msg_inc].fd != -1 &&
  1080. X        messages_so[msg_inc].mess_file_info !=
  1081. X            (struct struct_mo_info *) -1) {
  1082. X        cur_mess_so = messages_so[msg_inc];
  1083. X        last_entry_seen = msg_inc;
  1084. X        return (_gettext(cur_mess_so, msg_id));
  1085. X        } else {
  1086. X        return(msg_id);
  1087. X        }
  1088. X    }
  1089. X    msg_inc++;
  1090. X    }
  1091. X
  1092. X    /*
  1093. X       been though entire queue and not found 
  1094. X       open new entry if there is space.
  1095. X    */
  1096. X
  1097. X    if (msg_inc == MAX_MSG) {
  1098. X    return (msg_id);        /* not found and no more space */
  1099. X    }
  1100. X    if (first_free == MAX_MSG) {
  1101. X    return (msg_id);        /* no more space        */
  1102. X    }
  1103. X
  1104. X    /*
  1105. X     * There is an available entry in the queue, so make a
  1106. X     * message_so for it and put it on the queue, 
  1107. X     * return msg_id if message file isn't opened -or-
  1108. X     * mmap'd correctly
  1109. X    */
  1110. X
  1111. X/*
  1112. X    if ((fd = open(msgfile, O_RDONLY)) == -1) {
  1113. X    return (msg_id);
  1114. X    } else if (fstat(fd, &statbuf) == -1) {
  1115. X    close(fd);
  1116. X    return (msg_id);
  1117. X    } else if ((addr =
  1118. X    mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))
  1119. X        == (caddr_t) -1 ) {
  1120. X    close(fd);
  1121. X    return (msg_id);
  1122. X    }
  1123. X    close(fd);
  1124. X*/
  1125. X
  1126. X    fd = open(msgfile, O_RDONLY);
  1127. X
  1128. X    messages_so[first_free].fd = fd;
  1129. X    messages_so[first_free].message_so_path = strdup(msgfile);
  1130. X
  1131. X    if (fd == -1) {
  1132. X    first_free++;
  1133. X    close(fd);
  1134. X    return (msg_id);
  1135. X    }
  1136. X
  1137. X    fstat(fd, &statbuf);
  1138. X    addr = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
  1139. X    close(fd);
  1140. X
  1141. X    messages_so[first_free].mess_file_info = (struct struct_mo_info *) addr;
  1142. X    if (addr == (caddr_t) -1) {
  1143. X    first_free++;
  1144. X    return (msg_id);
  1145. X    }
  1146. X
  1147. X    messages_so[first_free].message_list =
  1148. X    (struct message_struct *) &messages_so[first_free].mess_file_info[1];
  1149. X    messages_so[first_free].msg_ids =
  1150. X    (char *) &messages_so[first_free].message_list[messages_so[first_free].mess_file_info->message_count];
  1151. X    messages_so[first_free].msgs =
  1152. X    (char *) messages_so[first_free].msg_ids + messages_so[first_free].mess_file_info->string_count_msgid;
  1153. X    cur_mess_so = messages_so[first_free];
  1154. X    first_free++;
  1155. X
  1156. X
  1157. X    /* return pointer to message */
  1158. X
  1159. X    return (_gettext(cur_mess_so,msg_id));
  1160. X}
  1161. X
  1162. X
  1163. Xchar *_gettext( messages, key_string )
  1164. X    struct message_so messages;
  1165. X        char *key_string ; 
  1166. X{
  1167. X    register int check;
  1168. X    register int val;
  1169. X    check = messages.mess_file_info->message_mid;
  1170. X    for (;;) {
  1171. X    if ((val=strcmp(key_string,
  1172. X        messages.msg_ids+messages.message_list[check].msgid_offset)) < 0) {
  1173. X        if (messages.message_list[check].less == -99) {
  1174. X        return (key_string);
  1175. X        } else {
  1176. X        check = messages.message_list[check].less;
  1177. X        }
  1178. X    } else if (val > 0) {
  1179. X        if (messages.message_list[check].more == -99) {
  1180. X                return (key_string);
  1181. X        } else {
  1182. X        check = messages.message_list[check].more;
  1183. X            }
  1184. X    } else {
  1185. X        return (messages.msgs+messages.message_list[check].msg_offset);
  1186. X        } /* if ((val= ... */
  1187. X    } /* for (;;) */
  1188. X}
  1189. X
  1190. X#endif /* SUNDAE */
  1191. END_OF_FILE
  1192. if test 9213 -ne `wc -c <'gettext.c'`; then
  1193.     echo shar: \"'gettext.c'\" unpacked with wrong size!
  1194. fi
  1195. # end of 'gettext.c'
  1196. fi
  1197. if test -f 'menu.h' -a "${1}" != "-c" ; then 
  1198.   echo shar: Will not clobber existing file \"'menu.h'\"
  1199. else
  1200. echo shar: Extracting \"'menu.h'\" \(8470 characters\)
  1201. sed "s/^X//" >'menu.h' <<'END_OF_FILE'
  1202. X/*
  1203. X *      (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
  1204. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  1205. X *      file for terms of the license.
  1206. X */
  1207. X
  1208. X#ident    "@(#)menu.h    26.24    91/09/14 SMI"
  1209. X
  1210. X/* a handy typedef for pointers to functions returning int */
  1211. Xtypedef int (*FuncPtr) ();
  1212. X
  1213. X#define NOBUTTON    -1    /* no button is active */
  1214. X#define PINBUTTON    -2    /* the pin is active */
  1215. X
  1216. X/* Button stacks (menus) are implemented as lists of buttons.
  1217. X * Each button in a stack may in turn be stacked, this is indicated by
  1218. X * the stacked flag of the button. If this flag is True then the buttonAction
  1219. X * is a pointer to a new stack. Otherwise it is the function to be called
  1220. X * after the menu has been dispatched.
  1221. X */
  1222. Xtypedef struct {
  1223. X    FuncPtr     callback;    /* if not stacked; call this */
  1224. X    struct _menu *submenu;    /* Menu hasn't been defined yet */
  1225. X}           ButtonAction;
  1226. X
  1227. X/*
  1228. X * Button Label:  a Label may be either a string or a pixmap or both
  1229. X *     Items which don't have a type are not active (like the 2nd choice
  1230. X *    of a non-toggle item)
  1231. X */
  1232. X
  1233. Xtypedef enum {NoType, StringLabel, ImageLabel, ComboLabel} ButtonLabelKind;
  1234. X
  1235. Xtypedef struct _buttonlabel {
  1236. X    ButtonLabelKind    kind;
  1237. X    char        *string;
  1238. X    Pixlabel        *pixlabel;
  1239. X} ButtonLabel;
  1240. X
  1241. X/*
  1242. X * Button
  1243. X */
  1244. Xtypedef struct _button {
  1245. X    ButtonLabel label[2];    /* displayed label, alternate label */
  1246. X    char       *helpstring[2];    /* help for that button, alternate help */
  1247. X    int        which;        /* which label to display */
  1248. X    Bool        stacked;    /* True if this is a button stack */
  1249. X    Bool    enabled;    /* Enabled/Disabled */
  1250. X    Bool    visible;    /* is this item visible at all? */
  1251. X    ButtonAction action;    /* proc or submenu */
  1252. X    FuncPtr    generate_func;    /* If !NULL, called when this button is
  1253. X                 * hilighted to re-initialize action.submenu */
  1254. X    char    *generate_args;    /* args for generate function */
  1255. X}           Button;
  1256. X
  1257. X/*
  1258. X * Menu
  1259. X */
  1260. Xtypedef struct _menu {
  1261. X    char       *title;
  1262. X    Button    **buttons;
  1263. X    int         buttonCount;
  1264. X    int         buttonDefault;
  1265. X    Bool        hasPushPin;
  1266. X    Bool    menudirty;    /* needs size recalced */
  1267. X    char       *helpstring;
  1268. X    int        btnPerCol;    /* Number buttons per column */
  1269. X    int        maxLabWidth;    /* Maximum label width */
  1270. X    int        maxLabHeight;    /* Maximum button/label height */
  1271. X    int        prefColSize;        /* # of preferred columns */
  1272. X}           Menu;
  1273. X
  1274. X#define basewin_openitem    0
  1275. X#define basewin_zoomitem    (basewin_openitem + 1)
  1276. X#define basewin_moveitem    (basewin_zoomitem + 1)
  1277. X#define basewin_resizeitem    (basewin_moveitem + 1)
  1278. X#define basewin_propsitem    (basewin_resizeitem + 1)
  1279. X#define basewin_backitem    (basewin_propsitem + 1)
  1280. X#define basewin_refreshitem    (basewin_backitem + 1)
  1281. X#define basewin_stickyitem    (basewin_refreshitem + 1)
  1282. X#define basewin_quititem    (basewin_stickyitem + 1)
  1283. X#define basewin_ctbuttons    (basewin_quititem + 1)
  1284. X
  1285. X#define popup_dismissitem    0
  1286. X#define popup_moveitem        (popup_dismissitem + 1)
  1287. X#define popup_resizeitem    (popup_moveitem + 1)
  1288. X#define popup_backitem        (popup_resizeitem + 1)
  1289. X#define popup_refreshitem    (popup_backitem + 1)
  1290. X#define popup_quititem        (popup_refreshitem + 1)
  1291. X#define popup_ctbuttons        (popup_quititem + 1)
  1292. X
  1293. X#define limit_dismissthisitem    0
  1294. X#define limit_dismissallitem    (limit_dismissthisitem + 1)
  1295. X#define limit_ctbuttons        (limit_dismissallitem + 1)
  1296. X
  1297. X/*
  1298. X * Global array of menus
  1299. X *
  1300. X * We need screen specific menus to get pixmaps in them, so this table
  1301. X * has been moved to screen.h
  1302. Xextern Menu *MenuTable[NUM_MENUS];
  1303. X */
  1304. Xextern Bool flDoSetDefault;    /*is the ctrl key down (only used in winpinmenu.c)*/
  1305. X
  1306. X/*
  1307. X * constants used by ShowStandardMenuSync()
  1308. X */
  1309. X#define SYNC_DONE        0
  1310. X#define SYNC_CHANGECLICK    (SYNC_DONE + 1)
  1311. X
  1312. X/*
  1313. X * ButtonInfo
  1314. X */
  1315. Xtypedef struct _buttonInfo {
  1316. X    Button     *button;
  1317. X    int         buttonX, buttonY;
  1318. X    int        buttonHeight;
  1319. X    Bool    flDirty;    /*damaged*/
  1320. X    Bool    framed;        /* True if button should be framed */
  1321. X    struct _menuInfo *subMenu;
  1322. X}           ButtonInfo;
  1323. X
  1324. X/*
  1325. X * MenuInfo
  1326. X */
  1327. Xtypedef struct _menuInfo {
  1328. X    int         depth;
  1329. X    Menu       *menu;
  1330. X    ButtonInfo *buttons;
  1331. X    int         notitleOffset, buttonOffset;
  1332. X    int         menuX, menuY, menuWidth, menuHeight;
  1333. X    int         titleX, titleY, titleHeight, titleWidth;
  1334. X    int         pushPinX, pushPinY;
  1335. X    int        maxbuttonWidth;
  1336. X    struct _wingeneric *menuWin;
  1337. X    struct _menuInfo *origmenuInfo;
  1338. X    struct _menuInfo *pinnedBrother;
  1339. X    Bool        childActive;
  1340. X    Bool        pinIn;
  1341. X    int         litButton;
  1342. X    Bool        ignoreNextExpose;
  1343. X    SemanticAction action;
  1344. X    int         ringedButton;
  1345. X    int        numColumns;
  1346. X}           MenuInfo;
  1347. X
  1348. X/*
  1349. X * MenuCache - per screen
  1350. X */
  1351. Xtypedef struct _menuCache {
  1352. X    MenuInfo   **menuInfoList;    /* dynamic */
  1353. X    int         nextSlot;
  1354. X    int        maxSlots;    /* how big is menuInfoList */ 
  1355. X    struct _winmenu **menuWinList;
  1356. X    int         maxDepth;
  1357. X}           MenuCache;
  1358. X
  1359. Xtypedef enum _menuTrackMode {
  1360. X    MODE_DRAG,    /* Press-Drag-Release */
  1361. X    MODE_CLICK    /* Click-Move-Click */
  1362. X}           MenuTrackMode;
  1363. X
  1364. Xtypedef enum _menuLocation {
  1365. X    ML_BUTTON,    /* On a button */
  1366. X    ML_PIN,/* On the pin */
  1367. X    ML_MENU,    /* Elsewhere on the menu */
  1368. X    ML_OFFMENU,    /* Outside the menu entirely */
  1369. X    ML_BUTTONDISABLED /*on a disabled button*/
  1370. X}           MenuLocation;
  1371. X
  1372. X#define BUTTON_INDEX_OK(mi,idx) ((idx)>=0 && (idx)<(mi)->menu->buttonCount)
  1373. X
  1374. X#ifdef notdef
  1375. X/*
  1376. X * Default button list
  1377. X */
  1378. Xtypedef struct _defaults {
  1379. X    char        Name[80];
  1380. X    int         DefaultButton;
  1381. X    MenuInfo   *mInfo;
  1382. X    struct _defaults *next;
  1383. X}           Defaults, *DefaultsP;
  1384. X#endif
  1385. X
  1386. X/*****************************************/
  1387. X
  1388. X
  1389. X/*
  1390. X *     External functions
  1391. X */
  1392. Xvoid SetMenuDefault();
  1393. XMenu *NewNamedMenu();
  1394. XBool AppendMenuItem();
  1395. XMenu *CreateMenu();
  1396. XMenu *GetEnabledMenu();
  1397. XMenuInfo *MenuInfoCreate();
  1398. Xvoid ShowStandardMenu();
  1399. Xvoid ShowStandardMenuSync();
  1400. Xvoid SetClickCallback();
  1401. X
  1402. Xextern void InitMenus();
  1403. Xextern MenuCache *InitScreenMenus( /* Display *dpy, ScreenInfo *scrInfo */ );
  1404. Xextern void MenuCreate( /* dpy, menu */ );
  1405. Xextern void MenuShow( /* dpy, WinGeneric, menu, event */ );
  1406. Xextern void SetButton( /* dpy, menu, bindex, Bool */ );
  1407. Xextern void ExecButtonAction( /* dpy, winInfo, menu, btn, Bool */ );
  1408. Xextern void DrawMenu( /* dpy, menu */ );
  1409. Xextern int  PointInRect( /* x, y, rx, ry, rw, rh */ );
  1410. X
  1411. X
  1412. X/*
  1413. X * generically useful region code that happens to live in menu.c
  1414. X */
  1415. X
  1416. Xvoid InitRegions();
  1417. Xvoid EmptyRegion();
  1418. Xvoid RectRegion();
  1419. Xvoid AppendExposeDamage();
  1420. Xvoid MakeExposeDamage();
  1421. X
  1422. X
  1423. X/*
  1424. X *    WinMenu Functions (from winmenu.c)
  1425. X */
  1426. Xextern struct _winmenu *
  1427. XMakeMenu( /* Display *dpy, 
  1428. X         WinRoot *winInfo */ 
  1429. X     );
  1430. Xextern void
  1431. XMapMenuWindow(/* Display *dpy, 
  1432. X         WinMenu *winInfo, 
  1433. X         MenuInfo *menuInfo */ 
  1434. X          );
  1435. Xextern void
  1436. XUnmapMenuWindow(/* Display *dpy, 
  1437. X           WinMenu *winInfo, 
  1438. X           MenuInfo *menuInfo */ 
  1439. X        );
  1440. X
  1441. X
  1442. Xint MenuEventExpose();
  1443. Xint MenuEventDrawMenu();
  1444. X
  1445. X
  1446. X/*
  1447. X *    WinPinMenu Functions (from winpinmenu.c)
  1448. X */
  1449. Xextern struct _winpinmenu *
  1450. XMakePinMenu(/* Display *dpy, 
  1451. X           WinRoot *winInfo, 
  1452. X           MenuInfo *menuInfo */ 
  1453. X        );
  1454. X
  1455. X
  1456. X/*
  1457. X * macros for setting menu items
  1458. X */
  1459. X
  1460. X#define DirtyMenu(pmenu)    (pmenu)->menudirty = True
  1461. X#define _menuset(p,i,q,x)    do { \
  1462. X                   Button *pb = p->buttons[i];    \
  1463. X                   if (pb->q != (x)) {        \
  1464. X                      DirtyMenu(p);        \
  1465. X                      pb->q = (x);        \
  1466. X                      }                \
  1467. X                } while(0)
  1468. X#define ToggleVisible(p,i,x)    _menuset(p,i,visible,(x))
  1469. X#define ToggleItem(p,i,x)    _menuset(p,i,which,(((x) == 0)? False : True))
  1470. X#define ToggleEnabled(p,i,x)    _menuset(p,i,enabled,(x))
  1471. X#define SetMenuTitle(m,t)    do {  \
  1472. X                   if (m->title != t) {        \
  1473. X                      m->title = t;        \
  1474. X                      DirtyMenu(m);        \
  1475. X                   }                \
  1476. X                 } while (0)
  1477. X
  1478. X/*
  1479. X * This stuff really belongs in the olgx library (in olgx.h, in fact).
  1480. X * But I don't want to ship that whole library, so I put it here and
  1481. X * included only ol_button.c from olgx
  1482. X */
  1483. X
  1484. X#define OLGX_LABEL_IS_COMB    0x0400    /* Label ix pixmap/string combination */
  1485. X
  1486. Xtypedef struct _comblabel {
  1487. X    Pixlabel    pixlabel;
  1488. X    char    *strlabel;
  1489. X} Comblabel;
  1490. X
  1491. X/*
  1492. X * eventX, eventY, eventTime
  1493. X *
  1494. X * Extract the xroot, yroot, or timestamp fields from an event, assuming it's
  1495. X * a MotionNotify, ButtonPress, or ButtonRelease.
  1496. X */
  1497. X
  1498. X#define eventX(e)       ((e)->type == MotionNotify ? (e)->xmotion.x_root \
  1499. X                           : (e)->xbutton.x_root )
  1500. X
  1501. X#define eventY(e)       ((e)->type == MotionNotify ? (e)->xmotion.y_root \
  1502. X                           : (e)->xbutton.y_root )
  1503. X
  1504. X#define eventTime(e)    ((e)->type == MotionNotify ? (e)->xmotion.time \
  1505. X                           : (e)->xbutton.time )
  1506. END_OF_FILE
  1507. if test 8470 -ne `wc -c <'menu.h'`; then
  1508.     echo shar: \"'menu.h'\" unpacked with wrong size!
  1509. fi
  1510. # end of 'menu.h'
  1511. fi
  1512. if test -f 'olvwmrc.man' -a "${1}" != "-c" ; then 
  1513.   echo shar: Will not clobber existing file \"'olvwmrc.man'\"
  1514. else
  1515. echo shar: Extracting \"'olvwmrc.man'\" \(9546 characters\)
  1516. sed "s/^X//" >'olvwmrc.man' <<'END_OF_FILE'
  1517. X.\" @(#)olvwmrc.man    1.1 olvwm version 1/3/92
  1518. X.TH OLVWMRC 5 "15 November 1991"
  1519. X.SH NAME
  1520. Xolvwmrc \- Resource file for the OPEN LOOK Virtual Window Manager
  1521. X.SH SYNOPSIS
  1522. X$HOME/.olvwmrc
  1523. X.SH DESCRIPTION
  1524. X .olvwmrc is a file which controls advanced keybinding and menu features
  1525. Xfor the OPEN LOOK Window Manager
  1526. X.I olvwm.
  1527. XThree features of
  1528. X.I olvwm
  1529. Xare controlled by entries in this file:
  1530. X.IP \fBKeybindings\fP
  1531. Xwhich can map specific actions to function keys
  1532. X.IP "\fBScreen Bindings\fP"
  1533. Xwhich can control where certain applications are started
  1534. X.IP \fBWINMENU\fP
  1535. Xentries which can control the behavior of items selected from the
  1536. X.I olvwm
  1537. XWINMENU menu.
  1538. X.LP
  1539. XThe syntax for each of these entries is given below.  Common to all
  1540. Xsyntax entries is the notion of an ``identifier'':  this is a string
  1541. Xwhich somehow specifies which window(s) the given entry applies to.
  1542. XWhen determining if a particular window is affected by a particular
  1543. Xrule in
  1544. X.I .olvwmrc,
  1545. X.I olvwm
  1546. Xfirst checks a window's WM_NAME to see if it matches the identifier
  1547. Xlisted in the rule.  This match is done only for the length of the
  1548. Xidentifier, so that the identifier 
  1549. X.I Mail
  1550. Xwill match all windows which
  1551. Xbegin with the 4 letters Mail in their WM_NAME.  If this does not match,
  1552. X.I olvwm
  1553. Xnext checks the instance and then the class fields of the window's
  1554. XWM_CLASS attribute to check for a possible match.  If a match is found
  1555. Xfor any of these fields, the window is affected by the given rule.  Case
  1556. Xis significant in checking all matches.
  1557. X.LP
  1558. XIdentifiers may contain any alpha-numeric characters; any other characters
  1559. Xmust be enclosed within quotes (single or double).  Thus,
  1560. X.I Mail
  1561. Xis a valid identifier, as is
  1562. X"\fIMail Tool\fP"
  1563. Xbut
  1564. X.I Mail Tool
  1565. Xis not.  Similarly, strings which are to be executed should be enclosed
  1566. Xin quotes if they contain non alpha-numeric characters.  Quotes may
  1567. Xbe nested in strings, so that to start a clock with the label
  1568. X.I foo bar,
  1569. Xyou would specify \fI 'clock -label "foo bar"'\fP.
  1570. XFinally, single quotes may be escaped with a backslash, so that the
  1571. Xfull WM_NAME of DevGuide, for example, should appear as
  1572. X\fI"OpenWindows Developer\\'s Guide"\fP.
  1573. X.LP
  1574. XAll whitespace in this file is ignored; and lines beginning with a #
  1575. Xare considered comments (but only if the # is in column 1).
  1576. X.SH Key/Action Bindings
  1577. X.I olvwm
  1578. Xcan be made to perfom a series of actions when a specific key is pressed.
  1579. XThe key must be (on a Sun-4 keyboard) a Left Key (L1-L10), a Function
  1580. XKey (F1-F10), or a Right Key (R1-R15).  The key may be specified by itself
  1581. Xor with any one or more of the following modifiers:  Shift, Control, Alt,
  1582. XMeta, Hyper, Super, Shift Lock, or Caps Lock, in which case the key
  1583. Xmust be pressed with the given modifiers.  Keyboards other than Sun-4
  1584. Xwill have to set up key mappings to generate X function or right key symbols.
  1585. X.LP
  1586. XThe functionality for a key specified in a binding in
  1587. X.I .olvwmrc
  1588. Xtakes precedence over any other functions that key might perform. Thus,
  1589. Xif you bind the L5 key to an action in
  1590. X.I .olvwmrc,
  1591. Xyou will not be able to use the L5 key to bring windows to the front;
  1592. Xif you bind the R8 key, you will not be able to scroll up on the desktop
  1593. Xusing that key.  Since the unmodified versions of 29 of the possible 35
  1594. Xkeys already have a meaning within
  1595. X.I olvwm,
  1596. Xit is recommend that at least one modifier be
  1597. Xused for keys in this manner so as not to conflict with other key meanings.
  1598. X.LP
  1599. XThere are six valid actions which can be associated with a key:
  1600. X.IP \fBWarp\fR
  1601. XThis action requires a single identifier.  The youngest window
  1602. Xmatching this identifier will be located, and the view into the desktop
  1603. Xwill be warped so that the found window is displayed on the screen.  The
  1604. Xwindow itself will not change position relative to the other windows;
  1605. Xmerely the view into the desktop will be changed.  If no matching
  1606. Xwindow is found, the view is unchanged.  The mouse is moved into the
  1607. Xmatching window, and that window is given input focus.
  1608. X.IP  \fBOpen\fR
  1609. XThis action requires a list of identifiers separated by commas.  Each
  1610. Xiconified window will be matched against this list and those which match
  1611. Xany identifier in the list will be opened.
  1612. X.IP  \fBClose\fR
  1613. XThis action requires a list of identifiers separated by commas.  Each
  1614. Xnon-iconified window will be matched against this list and those which match
  1615. Xany identifier in the list will be closed.
  1616. X.IP \fBRaise\fR
  1617. XThis action requires a list of identifiers separated by commas.  Each
  1618. Xwindow will be matched against this list and those which match any
  1619. Xidentifier in the list will be raised.  Windows will be raised youngest
  1620. Xfirst, so that the oldest windows in the list will end up on top.
  1621. X.IP \fBExecute\fR
  1622. XThis action requires a list of commands separated by commas.  Each
  1623. Xcommand will be executed via a Bourne-shell in the same manner as
  1624. Xcommands given in the 
  1625. X.I olvwm
  1626. Xmenu file [except that multiple commands may be listed in this case.]
  1627. X.IP \fBGoto\fR
  1628. XThis action requires a single integer parameter, which is the logical
  1629. Xscreen to which the desktop should warp when the given key(s) are pressed.
  1630. X.IP  \fBQuit\fR
  1631. XThis action requires a list of identifiers separated by commas.  Each
  1632. Xwindow will be matched against this list and those which match
  1633. Xany identifier in the list will be killed.
  1634. X.LP
  1635. XThese actions may appear in any order and will be performed in the
  1636. Xreverse of the order specified.  Commands may be listed multiple times;
  1637. Xthis is useful in case you want a different stacking order than that
  1638. Xobtained by using a single
  1639. Xraise command.  To do this, list separate raise commands for each window
  1640. Xand put the raise command for the window you want to be on top first.
  1641. X.LP
  1642. XThe full syntax for a Key/Action binding is
  1643. X.IP
  1644. X.I KeyName { Actions }
  1645. X.LP
  1646. XA Key Name is a valid key (L1-L10, F1-F10, or R1-R15) followed by plus
  1647. Xsigns and the modifiers desired.
  1648. X.LP
  1649. XFor example, given the following entry:
  1650. X.br
  1651. X.nf
  1652. X
  1653. XL2 + Shift {
  1654. X    Warp: "OpenWindows Developer\\'s Guide"
  1655. X    Execute: '$OPENWINHOME/bin/xview/clock -label "foo bar"',
  1656. X        "$OPENWINHOME/bin/xview/iconedit"
  1657. X    Raise: xterm, shelltool
  1658. X}
  1659. X
  1660. X.SH
  1661. XThen when Shift L2 is pressed, the following will occur:
  1662. X.IP 1)
  1663. XThe view will shift so that the youngest copy of DevGuide is on the screen.
  1664. X.IP 2)
  1665. XA clock will be started; its namestripe will contain foo bar.
  1666. XThe IconEditor will also be started.
  1667. X.IP 3)
  1668. XAll xterms and shelltools will be raised to the front of the stacking order.
  1669. X.SH Screen Bindings
  1670. X.I olvwm
  1671. Xcan arrange to begin any application relative to a particular logical screen.
  1672. XA ``logical screen'' is the area on the virtual desktop which maps to
  1673. Xthe size of your monitor; in the VDM, each logical screen is outlined in 
  1674. Xdashed lines (unless you've turned this feature off).  Screens are numbered
  1675. Xby row starting with 1.  Note that the position of a logical screen will
  1676. Xvary depending on the size of a desktop:  in the default (2x3) configuration,
  1677. Xscreen 4 is in the bottom left-hand corner of the VDM but in a smaller
  1678. X(2x2) configuration, it is in the bottom right-hand corner.
  1679. X.LP
  1680. XThe syntax for specifying a screen binding is
  1681. X.IP
  1682. X.I Screen # { Identifiers }
  1683. X.LP
  1684. Xwhere 
  1685. X.I #
  1686. Xis the logical number of the screen and
  1687. X.I Identifiers
  1688. Xis a list of comma-separated window identifiers for windows which should
  1689. Xalways start on that screen.  Note that it is always possible to move
  1690. Xthe window to another screen later.
  1691. X.LP
  1692. XFor example, the following entry will ensure that the windows started
  1693. Xby Sun's AnswerBook (windows with names Navigator and Viewer) will always
  1694. Xstart on screen 6:
  1695. X.br
  1696. X.nf
  1697. X
  1698. XScreen 6 { Navigator, Viewer }
  1699. X
  1700. X.SH WINMENU Actions
  1701. XWhen a window is selected in the WINMENU menu,
  1702. X.I olvwm
  1703. Xwill perform certain actions.  The possible actions are the same as those
  1704. Xlisted above for Key Actions, except that the mouse position will not change
  1705. Xon a warp.  By default, windows behave as if a warp,
  1706. Xraise, and open were performed on the selected window.
  1707. X.LP
  1708. XTo effect a different action list for a particular window, you can
  1709. Xspecify
  1710. X.IP
  1711. XIdentifier { Actions }
  1712. X.LP
  1713. XEach of these is a MenuGroup; one or more of these can appear
  1714. Xin the following syntax:
  1715. X.IP
  1716. XWINMENU { MenuGroups }
  1717. X.LP
  1718. XFor example, here is a possible entry:
  1719. X.nf
  1720. X
  1721. XWINMENU {
  1722. X    "File Manager" {
  1723. X        Warp: "Mail Tool"
  1724. X        Open: OLVWM_USE_SELECTION
  1725. X    }
  1726. X    xterm { }
  1727. X    "Virtual Desktop" {
  1728. X        Open: OLVWM_USE_SELECTION
  1729. X        Execute: "$OPENWINHOME/bin/props"
  1730. X    }
  1731. X}
  1732. X.SH
  1733. X.LP
  1734. XIf you select the Calendar Manager from your WINMENU, then the view will
  1735. Xwarp to your Mail Tool instead of your file manager, and your file
  1736. Xmanager, if closed, will be opened.  [This isn't that contrived an example:
  1737. Xpretend your file manager is sticky and your mail tool isn't, and you
  1738. Xanticipate that you'll need to drag between the two.]
  1739. X.LP
  1740. XIf you select an xterm from your WINMENU, absolutely nothing will happen.
  1741. XThis implements a No-Op for that window.
  1742. X.LP
  1743. XIf you select the VDM from your WINMENU, it will be opened and the properties
  1744. Xapplication will be started.
  1745. X.LP
  1746. XNote that this Identifier list can contain the special entry
  1747. X.I OLVWM_USE_SELECTION
  1748. Xwhich, as you might expect, operates on the single window corresponding to
  1749. Xthe one you selected.  A subtle distinction exists here:  given the MenuGroup
  1750. X.IP
  1751. Xxterm { Raise:  xterm }
  1752. X.LP
  1753. Xthen ALL xterms will be raised when any xterm is selected via the WINMENU.
  1754. XHowever, the entry
  1755. X.IP
  1756. Xxterm { Raise:  OLVWM_USE_SELECTION }
  1757. X.LP
  1758. Xwill raise only the xterm corresponding to the one selected via the WINMENU.
  1759. X.SH SEE ALSO
  1760. X.LP
  1761. Xolvwm(1), olwm(1)
  1762. X.SH NOTES
  1763. X.LP
  1764. XPlease see the LEGAL_NOTICES file for full disclosure of copyright
  1765. Xinformation.
  1766. END_OF_FILE
  1767. if test 9546 -ne `wc -c <'olvwmrc.man'`; then
  1768.     echo shar: \"'olvwmrc.man'\" unpacked with wrong size!
  1769. fi
  1770. # end of 'olvwmrc.man'
  1771. fi
  1772. if test -f 'olwm.h' -a "${1}" != "-c" ; then 
  1773.   echo shar: Will not clobber existing file \"'olwm.h'\"
  1774. else
  1775. echo shar: Extracting \"'olwm.h'\" \(4886 characters\)
  1776. sed "s/^X//" >'olwm.h' <<'END_OF_FILE'
  1777. X/*
  1778. X *      (c) Copyright 1989, 1990 Sun Microsystems, Inc. Sun design patents
  1779. X *      pending in the U.S. and foreign countries. See LEGAL_NOTICE
  1780. X *      file for terms of the license.
  1781. X */
  1782. X
  1783. X#ifndef _OLWM_OLWM_H
  1784. X#define _OLWM_OLWM_H
  1785. X
  1786. X#ident    "@(#)olwm.h    26.19    91/09/14 SMI"
  1787. X
  1788. X#ifndef ABS
  1789. X#define ABS(a)        (((a) < 0) ? -(a) : (a))
  1790. X#endif
  1791. X
  1792. X#ifndef MAX
  1793. X#define    MAX(a,b)    (((a) > (b)) ? (a) : (b))
  1794. X#endif
  1795. X
  1796. X#ifndef MIN
  1797. X#define MIN(a,b)        ((a) < (b) ? (a) : (b))
  1798. X#endif
  1799. X
  1800. X/* Determine the size of an object type in 32bit multiples.
  1801. X * Rounds up to make sure the result is large enough to hold the object. */
  1802. X#define LONG_LENGTH(a)    ((long)(( sizeof(a) + 3 ) / 4))
  1803. X
  1804. X#define    FOOTLEN    50L
  1805. X
  1806. X/* protocols bits */
  1807. X#define        TAKE_FOCUS        (1<<0)
  1808. X#define        SAVE_YOURSELF        (1<<1)
  1809. X#define        DELETE_WINDOW        (1<<2)
  1810. X
  1811. X/* Icon positioning modes */
  1812. Xtypedef enum { AlongTop, AlongBottom, AlongRight, AlongLeft,
  1813. X           AlongTopRL, AlongBottomRL, AlongRightBT, AlongLeftBT
  1814. X         } IconPreference;
  1815. X
  1816. X/* size of icon window */
  1817. X#define ICON_WIN_WIDTH 60
  1818. X#define ICON_WIN_HEIGHT 60
  1819. X#define ICON_GRID_WIDTH 13
  1820. X#define ICON_GRID_HEIGHT 13
  1821. X
  1822. X/* min/max/inc icon sizes */
  1823. X#define ICON_MIN_WIDTH         1
  1824. X#define ICON_MIN_HEIGHT     1
  1825. X#define ICON_MAX_WIDTH        128
  1826. X#define ICON_MAX_HEIGHT        128
  1827. X#define ICON_WIDTH_INC        1
  1828. X#define ICON_HEIGHT_INC        1
  1829. X
  1830. X/* minimum window size */
  1831. X#define MINSIZE 5
  1832. X
  1833. X/* adornment pixmaps */
  1834. Xextern    Pixmap    pixIcon;
  1835. Xextern    Pixmap    pixmapGray;
  1836. Xextern    Pixmap    pixGray;
  1837. X
  1838. X/* miscellaneous functions */
  1839. Xextern int ExitOLWM();
  1840. Xextern void *GetWindowProperty();
  1841. X
  1842. X/* state functions */
  1843. Xextern struct _client *StateNew();
  1844. Xextern void ReparentTree();
  1845. Xextern void StateNormIcon();
  1846. Xextern void StateIconNorm();
  1847. Xextern void StateWithdrawn();
  1848. X
  1849. X/* root window functions */
  1850. Xextern struct _winroot *MakeRoot();
  1851. X
  1852. X/* no-focus window information and functions */
  1853. Xextern Window NoFocusWin;
  1854. Xextern struct _wingeneric *NoFocusWinInfo;
  1855. X
  1856. Xextern struct _wingeneric *MakeNoFocus();
  1857. Xextern void NoFocusTakeFocus();
  1858. Xextern void NoFocusInit();
  1859. Xextern int NoFocusEventBeep();
  1860. X
  1861. X/* client information and functions */
  1862. Xextern struct _List *ActiveClientList;
  1863. X
  1864. Xextern struct _client *ClientCreate();
  1865. Xextern Window ClientPane();
  1866. Xtypedef struct _clientinboxclose {
  1867. X    Display *dpy;
  1868. X    int     screen;
  1869. X    int     (*func)();
  1870. X    short     bx, by, bw, bh;
  1871. X    Time     timestamp;
  1872. X} ClientInBoxClosure;
  1873. Xextern void *ClientInBox();
  1874. Xextern void ClientInhibitFocus();
  1875. Xextern void ClientSetFocus();
  1876. Xextern void ClientSetCurrent();
  1877. Xextern struct _client *ClientGetLastCurrent();
  1878. Xextern void ClientActivate();
  1879. Xextern void ClientFocusTopmost();
  1880. X
  1881. X/* frame functions */
  1882. Xextern struct _winpaneframe *MakeFrame();
  1883. Xextern void FrameSetPosFromPane();
  1884. Xextern void FrameFullSize();
  1885. Xextern void FrameNormSize();
  1886. Xextern void FrameNewFooter();
  1887. Xextern void FrameNewHeader();
  1888. Xextern void FrameSetBusy();
  1889. Xextern void FrameWarpPointer();
  1890. Xextern void FrameUnwarpPointer();
  1891. X
  1892. X/* generic frame functions */
  1893. Xextern int GFrameFocus();
  1894. Xextern int GFrameSelect();
  1895. Xextern int GFrameSetConfigFunc();
  1896. Xextern void GFrameSetStack();
  1897. Xextern void GFrameSetConfig();
  1898. Xextern int GFrameEventButtonPress();
  1899. Xextern int GFrameEventMotionNotify();
  1900. Xextern int GFrameEventButtonRelease();
  1901. Xextern int GFrameEventFocus();
  1902. Xextern int GFrameEventEnterNotify();
  1903. X
  1904. X/* icon functions */
  1905. Xextern void IconInit();
  1906. Xextern struct _winiconframe *MakeIcon();
  1907. Xextern void IconChangeName();
  1908. Xextern void DrawIconToWindowLines();
  1909. Xextern void IconShow();
  1910. Xextern void IconHide();
  1911. Xextern void IconSetPos();
  1912. X
  1913. X/* icon pane functions */
  1914. Xextern struct _winiconpane *MakeIconPane();
  1915. X
  1916. X/* pane functions */
  1917. Xextern struct _winpane *MakePane();
  1918. X
  1919. X/* pinned menu functions */
  1920. Xextern struct _winmenu *MakeMenu();
  1921. X
  1922. X/* colormap functions */
  1923. Xextern struct _wingeneric *MakeColormap();
  1924. Xextern void TrackSubwindows();
  1925. Xextern void UnTrackSubwindows();
  1926. Xextern void ColormapInhibit();
  1927. Xextern void InstallColormap();
  1928. Xextern void InstallPointerColormap();
  1929. Xextern void UnlockColormap();
  1930. Xextern void ColorWindowCrossing();
  1931. Xextern struct _wingeneric *ColormapUnhook();
  1932. Xextern void ColormapTransmogrify();
  1933. X
  1934. X/* selection functions */
  1935. Xextern Bool IsSelected();
  1936. Xextern struct _client *EnumSelections();
  1937. Xextern Time TimeFresh();
  1938. Xextern int AddSelection();
  1939. Xextern Bool RemoveSelection();
  1940. Xextern Bool ToggleSelection();
  1941. Xextern void ClearSelections();
  1942. Xextern void SelectionResponse();
  1943. X
  1944. X/* decoration window functions */
  1945. Xextern struct _winpushpin *MakePushPin();
  1946. Xextern struct _winbutton *MakeButton();
  1947. X
  1948. X/* general window functions */
  1949. Xextern void WinCallFocus();
  1950. Xextern void WinRedrawAllWindows();
  1951. Xextern Bool WinShowHelp();
  1952. X
  1953. X/* general window event functions */
  1954. Xextern int WinEventExpose();
  1955. Xextern int WinNewPosFunc();
  1956. Xextern int WinNewConfigFunc();
  1957. Xextern int WinSetConfigFunc();
  1958. X
  1959. X/* rubber-banding functions */
  1960. Xextern void UserMoveWindows();
  1961. Xextern void UserResizeWin();
  1962. Xextern void TraceRootBox();
  1963. X
  1964. X/* busy windows */
  1965. Xextern struct _winbusy *MakeBusy();
  1966. X
  1967. X#endif /* _OLWM_OLWM_H */
  1968. END_OF_FILE
  1969. if test 4886 -ne `wc -c <'olwm.h'`; then
  1970.     echo shar: \"'olwm.h'\" unpacked with wrong size!
  1971. fi
  1972. # end of 'olwm.h'
  1973. fi
  1974. echo shar: End of archive 18 \(of 21\).
  1975. cp /dev/null ark18isdone
  1976. MISSING=""
  1977. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do
  1978.     if test ! -f ark${I}isdone ; then
  1979.     MISSING="${MISSING} ${I}"
  1980.     fi
  1981. done
  1982. if test "${MISSING}" = "" ; then
  1983.     echo You have unpacked all 21 archives.
  1984.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1985. else
  1986.     echo You still need to unpack the following archives:
  1987.     echo "        " ${MISSING}
  1988. fi
  1989. ##  End of shell archive.
  1990. exit 0
  1991. --
  1992. Molecular Simulations, Inc.             mail: dcmartin@postgres.berkeley.edu
  1993. 796 N. Pastoria Avenue                  uucp: uwvax!ucbvax!dcmartin
  1994. Sunnyvale, California 94086             at&t: 408/522-9236
  1995.